package net.wofly.sale.order.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.activiti.engine.task.Comment;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wofly.flow.dto.FormPropertyDto;
import net.wofly.right.domain.User;

/**
 * 退货
 *
 * @author lign
 * @version 1.0
 * @created 06-5月-2018 11:58:46
 */
@Data
@Entity
@Table(name = "sale_order_returnsales")
@ApiModel(description = "退货")
public class ReturnSales {
    
    @ApiModelProperty("退货内容")
    @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    @JoinColumn(name = "returnSalesID")
    public List<ReturnSalesContent> returnSalesContents;
    
    @ApiModelProperty("退货赠品信息")
    @OneToMany(cascade = CascadeType.MERGE,fetch = FetchType.LAZY)
    @JoinColumn(name = "returnSalesID")
    public List<ReturnGift> returnGifts;
    
    @Id
    private String returnSalesID;
    
    private Integer commodityNum;
    /**
     * 要退货的客户ID
     * 即订单的购买客户ID
     */
    private String customerUserID;
    @ApiModelProperty("客户名称")
    @Transient
    private String customerName;
    private Integer giftNum;
    private Long modifyDate;
    /**
     * 退货的订单Id
     */
    private String orderID;
    @ApiModelProperty("原始订单编号")
    private String orderNo;
    private Integer orderType;
    @ApiModelProperty("原始订单类型")
    @Transient
    private String orderTypeStr;
    /**
     * 退货人（下退货订单的人）
     * <ul>
     * <li>客户下单就是客户，业务经理下单就是业务经理</li>
     * <li></li>
     * </ul>
     */
    private String returner;
    /**
     * 退货号
     */
    private String returnSalesNO;
    /**
     * 退货时间
     */
    private Long returnSalesTime;
    private Integer status;
    private Double totalPrice;
    
    private Integer isFinish = 0 ;
    
    @ApiModelProperty(value = "工作流定义key")
    private String processDefKey ;
    
    @ApiModelProperty(value = "工作流实例ID")
    private String processInsID ;
    
    @ApiModelProperty(value = "工作流任务ID")
    private String taskID ;
    
    @ApiModelProperty(value = "工作流任务名称")
    private String taskName ;
    
    @ApiModelProperty(value = "工作流实例审批意见")
    @Transient
	private List<Comment> comments ;
	
    @ApiModelProperty(value = "任务表单内容")
	@Transient
	private List<FormPropertyDto> formPropertyDtos ;
    
    @Transient
    private String statusStr;
    
    @Transient
    private User returnUser;
    
    @Transient
    private String returnUserName;
    
    public ReturnSales() {
    
    }
    
    @Override
    public void finalize() throws Throwable {
    
    }
}